From: Juergen Gross Date: Thu, 17 Feb 2011 19:39:13 +0000 (+0000) Subject: xl cpupool-numa-split: reduce number of Dom0 vcpus X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10755 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=a9dd01431a799b6743193a75f4f1ce2fdfdb7296;p=xen.git xl cpupool-numa-split: reduce number of Dom0 vcpus When reducing the number of physical cpus available for Domain-0 by xl cpupool-numa-split, reduce the number of vcpus accordingly. Signed-off-by: juergen.gross@ts.fujitsu.com Acked-by: Ian Jackson Signed-off-by: Ian Jackson --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 32306de1c0..c1ff5a2e88 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -5785,6 +5785,7 @@ int main_cpupoolnumasplit(int argc, char **argv) libxl_cpumap cpumap; libxl_cpupoolinfo *poolinfo; libxl_topologyinfo topology; + libxl_dominfo info; while ((opt = getopt(argc, argv, "h")) != -1) { switch (opt) { @@ -5840,11 +5841,33 @@ int main_cpupoolnumasplit(int argc, char **argv) goto out; } + n = 0; for (c = 0; c < topology.nodemap.entries; c++) { if (topology.nodemap.array[c] == node) { topology.nodemap.array[c] = LIBXL_CPUARRAY_INVALID_ENTRY; + libxl_cpumap_set(&cpumap, n); + n++; + } + } + if (libxl_set_vcpuonline(&ctx, 0, &cpumap)) { + fprintf(stderr, "error on removing vcpus for Domain-0\n"); + goto out; + } + for (c = 0; c < 10; c++) { + if (libxl_domain_info(&ctx, &info, 0)) { + fprintf(stderr, "error on getting info for Domain-0\n"); + goto out; + } + if (info.vcpu_online == n) { + break; } + sleep(1); + } + if (info.vcpu_online > n) { + fprintf(stderr, "failed to offline vcpus\n"); + goto out; } + memset(cpumap.map, 0, cpumap.size); for (c = 0; c < topology.nodemap.entries; c++) { if (topology.nodemap.array[c] == LIBXL_CPUARRAY_INVALID_ENTRY) {